#ifndef __M_MESSAGE_HPP__
#define __M_MESSAGE_HPP__

#include <iostream>
#include <string>
#include <thread>
#include "level.hpp"
#include "util.hpp"

/*
    定义日志消息类，进行日志中间信息的存储 
    1、日志时间
    2、日志等级
    3、源文件名称
    4、源代码行号
    5、线程ID
    6、日志主体消息
    7、日志器名称
*/

namespace mylog
{
    struct LogMsg
    { 
        time_t _ctime;
        LogLevel::value _level;
        std::string _file;
        size_t _line;
        std::thread::id _tid;
        std::string _payload;
        std::string _logger;

        LogMsg(LogLevel::value level,
               size_t line,
               const std::string file,
               const std::string logger,
               const std::string msg)
               : _level(level), _ctime(mylog::util::Date::now()), _line(line), _file(file), _logger(logger), _payload(msg), _tid(std::this_thread::get_id())
        {}
    };
} 

#endif //__M_MESSAGE_HPP__